struct PongState
{
    // X position of the paddle center
    int paddlePosition;
    int paddleOpponentPosition;

    // Position of the ball's center
    int ballXPosition;
    int ballYPosition;
    int ballXVelocity;
    int ballYVelocity;

    int level;
    int score;

    Grid<int> blocks;
    int blocksRemaining;

    int framesSinceReset;
    int bouncesSinceReset;
};

class GamePong : public Game
{
public:
    void Init();
    string Name()
    {
        return "pong";
    }
    void NewGame();
    void Step(ControllerState &controller);
    ControllerState SimpleAI();

private:
    void NextLevel();
    void MakeFrameSprites();

    // Get the x-velocity of the ball after hitting the paddle
    int GetBallXVelocity(int offset);

    PongState _state;

    // Sprite IDs
    int _spritePaddle1;
    int _spritePaddle2;
    int _spriteBallUp;
    int _spriteBallDown;
    int _spriteWall;
    int _emptyBlock;
    int _spriteBlueBlock;
};